package com.css.zfzx.sjcj.modules.hddcB4_SampleProjectTable.repository;

import com.css.zfzx.sjcj.modules.hddcA1InvRgnHasMaterialTable.repository.entity.HddcA1InvrgnhasmaterialtableEntity;
import com.css.zfzx.sjcj.modules.hddcB4_SampleProjectTable.repository.entity.HddcB4SampleprojecttableEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author zhangcong
 * @date 2020-11-30
 */
public interface HddcB4SampleprojecttableRepository extends JpaRepository<HddcB4SampleprojecttableEntity, String> {
    @Modifying
    @Query(nativeQuery = true,value = "update hddc_b4_sampleprojecttable set qualityinspection_status=:qualityinspection_status ,extends1=:extend1 where uuid=:uuid")
    void updateStatus(@Param("qualityinspection_status") String qualityinspection_status,@Param("extend1") String extend1,@Param("uuid") String uuid);

    @Modifying
    @Query(nativeQuery = true,value = "update hddc_b4_sampleprojecttable set qualityinspection_status=:qualityinspection_status ,extends2=:extend2 where targetregionid=:targetregionid")
    void updatembStatus(@Param("qualityinspection_status") String qualityinspection_status,@Param("extend2")  String extend1,@Param("targetregionid") String targetregionid);

    @Modifying
    @Query(nativeQuery = true,value = "update hddc_b4_sampleprojecttable set qualityinspection_status=:qualityinspection_status ,extends3=:extend3 where mainafsregionid=:mainafsregionid")
    void updateztqStatus(@Param("qualityinspection_status") String qualityinspection_status,@Param("extend3")  String extend1,@Param("mainafsregionid") String mainafsregionid);

    @Query(nativeQuery = true,value = "select * from hddc_b4_sampleprojecttable where is_valid=1 and extends10 =1 ")
    List<HddcB4SampleprojecttableEntity> findByAll();

    @Query(nativeQuery = true,value = "select * from hddc_b4_sampleprojecttable where id=?1 and  is_valid=1 ")
    HddcB4SampleprojecttableEntity findbyId(String id);

    HddcB4SampleprojecttableEntity findByUuidAndIsValid(String id, String isValid);
}
